/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package carstore.carstoreserver.models;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author wuhao
 */
@Entity
@Table(name = "carstore")
@XmlRootElement
@NamedQueries({
	@NamedQuery(name = "Carstore.findAll", query = "SELECT c FROM Carstore c"),
	@NamedQuery(name = "Carstore.findByStoreId", query = "SELECT c FROM Carstore c WHERE c.storeId = :storeId"),
	@NamedQuery(name = "Carstore.findByStoreName", query = "SELECT c FROM Carstore c WHERE c.storeName = :storeName"),
	@NamedQuery(name = "Carstore.findByLon", query = "SELECT c FROM Carstore c WHERE c.lon = :lon"),
	@NamedQuery(name = "Carstore.findByLat", query = "SELECT c FROM Carstore c WHERE c.lat = :lat"),
	@NamedQuery(name = "Carstore.findByPhone", query = "SELECT c FROM Carstore c WHERE c.phone = :phone"),
	@NamedQuery(name = "Carstore.findByMaxCustomer", query = "SELECT c FROM Carstore c WHERE c.maxCustomer = :maxCustomer")})
public class Carstore implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Basic(optional = false)
        @Column(name = "STORE_ID")
	private Integer storeId;
	@Size(max = 255)
        @Column(name = "STORE_NAME")
	private String storeName;
	// @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
	@Column(name = "LON")
	private Double lon;
	@Column(name = "LAT")
	private Double lat;
	// @Pattern(regexp="^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", message="电话/传真格式无效, 应为 xxx-xxx-xxxx")//if the field contains phone or fax number consider using this annotation to enforce field validation
	@Size(max = 255)
        @Column(name = "PHONE")
	private String phone;
	@Column(name = "MAX_CUSTOMER")
	private Integer maxCustomer;

	public Carstore() {
	}

	public Carstore(Integer storeId) {
		this.storeId = storeId;
	}

	public Integer getStoreId() {
		return storeId;
	}

	public void setStoreId(Integer storeId) {
		this.storeId = storeId;
	}

	public String getStoreName() {
		return storeName;
	}

	public void setStoreName(String storeName) {
		this.storeName = storeName;
	}

	public Double getLon() {
		return lon;
	}

	public void setLon(Double lon) {
		this.lon = lon;
	}

	public Double getLat() {
		return lat;
	}

	public void setLat(Double lat) {
		this.lat = lat;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Integer getMaxCustomer() {
		return maxCustomer;
	}

	public void setMaxCustomer(Integer maxCustomer) {
		this.maxCustomer = maxCustomer;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (storeId != null ? storeId.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are not set
		if (!(object instanceof Carstore)) {
			return false;
		}
		Carstore other = (Carstore) object;
		if ((this.storeId == null && other.storeId != null) || (this.storeId != null && !this.storeId.equals(other.storeId))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "carstore.ui.models.Carstore[ storeId=" + storeId + " ]";
	}
	
}
